/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ControleAcademico.Model.Pojo;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.ManyToOne;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
/**
 *
 * @author arthur
 * @author renan
 * @author tais
 * @author vinicius
 */

@Entity
@Table(name="HistoricoDisciplinas")
public class HistoricoDisciplinas implements Serializable{
    
    
    // Atributos
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Column(name = "id",unique=true,nullable=false)
    private int id;
    
    @Column(name = "Nota_Final")
    private double notaFinal;
    
    @Column(name = "Numero_Faltas")
    private int numeroFaltas;
    
    @JoinColumn (name= "Matriculado " ,referencedColumnName= "id")
    @ManyToOne(fetch= FetchType.LAZY)
    private Aluno matriculado;
    
    @JoinColumn (name= "Disciplina" ,referencedColumnName= "id")
    @ManyToOne(fetch= FetchType.LAZY)
    private Disciplina disciplina;

    public HistoricoDisciplinas() {
    }
    

    
    // Metodos  
    
    public void setId(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }
    public double getNota(){return this.notaFinal;}
    public void setNota(double notaFinal){this.notaFinal = notaFinal;}
    public int getNumeroFaltas(){return this.numeroFaltas;}
    public void setNumeroFaltas(int numeroFaltas){this.numeroFaltas = numeroFaltas;}
    public Aluno getMatriculado(){return this.matriculado;}
    public Disciplina getDisciplina() {
        return disciplina;
    }

    public void setDisciplina(Disciplina disciplina) {
        this.disciplina = disciplina;
    }
    
    
    public HistoricoDisciplinas(Aluno matriculado, Disciplina disciplina, double notaFinal, int id){
        this.notaFinal = notaFinal;
        this.numeroFaltas = 0;
        this.matriculado = matriculado;
        this.disciplina = disciplina;
        this.id = id;
    }
    
    public void lancarFalta(int faltas) {
        this.numeroFaltas += faltas;
    }
    
     void lancarNotaFinal(double notaFinal) {
        this.notaFinal = notaFinal;
    }
}
